﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Yammu.Core.MediaManagement;
using Yammu.Core.VirtualFileSystem;
using System.IO;
using System.Diagnostics.Contracts;

namespace Yammu.Core.MediaManagement
{
    public abstract class MediaItemBase : MarshalByRefObject, IMediaItem
    {
        
        protected string _fullPath ;
        protected IVFSProvider _provider;
        #region Implementation of IMediaItem
        
        public string Name
        {
            get { return System.IO.Path.GetFileName(_fullPath); }
            
        }

        public string Path
        {
            get 
            { 
                Contract.Requires(! string.IsNullOrWhiteSpace(FullPath));
                return System.IO.Path.GetDirectoryName(_fullPath); 
            }
        }

        public string FullPath
        {
            get { return _fullPath; }
            set
            {
                Contract.Requires(!string.IsNullOrWhiteSpace(value));
                _fullPath = value; 
            }
        }

        public IVFSProvider Provider
        {
            get
            {
                return _provider;
            }
            set
            {
                Contract.Requires(value != null);
                _provider = value;
            }
        }

        public  abstract bool IsDirectory{get;}

        #endregion
    }
}
